package game.view.screen.components 
{
	import flash.display.Bitmap;
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.text.TextField;
	import starling.textures.Texture;
	/**
	 * ...
	 * @author Thot
	 */
	public class BuildingComponent extends Sprite
	{
		private var _image:Image;
		private var _progression:TextField;
		
		public function BuildingComponent() 
		{
		}
		
		public function init( p_texture:Texture ):void 
		{
			_progression = new TextField( 100, 20, "" );
			_image = new Image( p_texture );
			addChild( _image );
			addChild( _progression );
		}
		
		
		public function set increasing( value:Boolean ):void
		{
			if ( value )
			{
				addChild( _progression );
			}
			else
			{
				removeChild( _progression );
			}
		}
		
		public function set progression( p_progression:int ):void
		{
			//var txt:String
			_progression.text = p_progression + "s";
		}
		
		public function set texture( value:Texture ):void
		{
			_image.texture = value;
		}
		
		public function get texture():Texture
		{
			return _image.texture;
		}
		
		public function destroy():void
		{
			removeChild( _image );
			removeChild( _progression );
			_progression = null;
			_image = null;
		}
		
	}

}